package com.xukehong.demo.controller;

import com.google.common.collect.ImmutableSet;
import com.xukehong.demo.model.WxJsApiModel;
import io.swagger.annotations.Api;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: xkh
 * @Date: 2019/4/11 15:05
 * @Version 1.0
 */
@Controller
@RequestMapping("/wx")
@Api(tags = "微信接口")
public class WxController {

    public static final ImmutableSet<String> COLOR_MAMES = ImmutableSet.of("red","orange");

    @GetMapping("/jsapi")
    public String wxJsapi(WxJsApiModel wxJsApiModel, Model model, HttpServletRequest request) {

        request.setAttribute("referer","http://www.baidu.com");
        System.out.println("获取到的WxJsApiModel:"+wxJsApiModel);
        model.addAttribute("jsapi", wxJsApiModel);
        model.addAttribute("package",wxJsApiModel.getPackagealias());
        return "payment/wx/WxJsApi";
    }

    @GetMapping("/demo")
    public String demo(Model model, HttpServletRequest request) {
        request.setAttribute("referer","http://www.baidu.com");
        System.out.println("---------------------");
        return "payment/wx/xxxx";
    }

}
